#ifndef XPM_DOC_MODEL_RDF_KNOWLEDGEBASE_H
#define XPM_DOC_MODEL_RDF_KNOWLEDGEBASE_H

#include "Cls.h"
#include "Slot.h"
#include "Instance.h"
#include <string>
#include <vector>

using namespace std;

namespace xpm {
	typedef map<string, Cls*> ClsesMap;
	typedef ClsesMap::iterator ClsesIter;
	typedef map<string, Slot*> SlotsMap;
	typedef SlotsMap::iterator SlotsIter;
	typedef map<string, Instance*> InstancesMap;
	typedef InstancesMap::iterator InstancesIter;

	class KnowledgeBase {
	public:
		KnowledgeBase();
		~KnowledgeBase();
		Cls* getRootClses();
		Cls* createCls(string clsName, Cls* superCls);
		Slot* createSlot(string slotName);
		Instance* createInstance(string instanceName, Cls* cls);
		void removeCls(Cls* cls);
		void removeSlot(Slot* slot);
		void removeInstance(Instance* instance);
		Cls* findCls(string clsName);
		Slot* findSlot(string slotName);
		Instance* findInstance(string instanceName);
		void clear();
		ClsesMap& clses();
		SlotsMap& slots();
		InstancesMap& instances();
	private:
		Cls* _rootClses;
		ClsesMap _clses;
		SlotsMap _slots;
		InstancesMap _instances;
	};
}
#endif